package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.PlanSta;
import com.indusfo.spc.service.PlanStaService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: 熊冰
 * @Date: 2019/11/9 13:11
 * 任务单流程工位
 */

@Controller
@RequestMapping("/planSta")
public class PlanStaController {
	@Autowired
	private PlanStaService planStaService;

	//查询
	@RequestMapping(value="/queryPlanSta")
	@ResponseBody
	public JSONObject queryPlanSta(PlanSta planSta) {
		JSONObject json = planStaService.queryPlanSta(planSta);
		return json;
	}

	//新增
	@RequestMapping(value="/insertPlanSta", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject insertPlanSta(PlanSta planSta) {
		JSONObject json = planStaService.insertPlanSta(planSta);
		return json;
	}

	//修改
	@RequestMapping(value = "/updatePlanSta",method= RequestMethod.POST)
	@ResponseBody
	public JSONObject updatePlanSta (PlanSta planSta){
		JSONObject json=planStaService.updatePlanSta(planSta);
		return json;
	}

	//删除
	@RequestMapping(value="/deletePlanSta", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject deletePlanSta(@RequestParam("planStaIds") List<Integer> planStaIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planStaService.deletePlanSta(planStaIds, dataState);
		return json;
	}

	//启用
	@RequestMapping(value="/startPlanSta", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject startPlanSta(@RequestParam("planStaIds") List<Integer> planStaIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planStaService.deletePlanSta(planStaIds, dataState);
		return json;
	}

	//停用
	@RequestMapping(value="/stopPlanSta", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject stopPlanSta(@RequestParam("planStaIds") List<Integer> planStaIds, Integer dataState) {
		dataState = 2;
		JSONObject json = planStaService.deletePlanSta(planStaIds, dataState);
		return json;
	}





}

